<?php

  class Button extends Component {
    private $label;
    private $isolate = false;

    function getLabel() {
      return $label;
    }
    function isolate($isolate) {
        $this->isolate = $isolate;
    }
    function show($id) {
      parent::show($id,$this->label);
      echo "document.getElementById('" . $id . "').appendChild(el);\n";
      echo "el.onmouseover = function() {\n";
      echo "  this.style.backgroundColor = '#357AE8';\n";
      echo "  this.style.border = '1px solid #2F5BB7';\n";
      echo "}\n";
      echo "el.onmouseout = function() {\n";
      echo "  this.style.backgroundColor = '#4D90FE';\n";
      echo "  this.style.border = '1px solid #3079ED';\n";
      echo "}\n";
      echo "el.onclick = function() {\n";
      if($this->isolate == false) echo "  send_event('" . $this->uuid . "','onclick',false);\n";
      else echo "  send_event('" . $this->uuid . "','onclick',true);\n";
      echo "}\n";

    }
    function __construct($uuid,$label="Button") {
      parent::__construct($uuid);
      $this->label = $label;
      $this->setStyle("background","#4D90FE");
      $this->setStyle("border","1px solid #3079ED");
      $this->setStyle("textAlign","center");
      $this->setStyle("color","#FFFFFF");
      $this->setStyle("fontWeight","bold");
      $this->setStyle("cursor","pointer");
      $this->setBounds(20,40,100,30);
      $this->setStyle("lineHeight",$this->height . "px");

    }

  }

?>